import { Dropdown } from 'antd';
import type { MenuProps } from 'antd';
import type { DropDownProps } from 'antd/es/dropdown';
import classNames from 'classnames';
import React from 'react';
import styles from './index.less';

export type HeaderDropdownProps = {
  overlayClassName?: string;
  menu: MenuProps;
  placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter';
} & Omit<DropDownProps, 'overlay'>;

const HeaderDropdown: React.FC<HeaderDropdownProps> = ({
  overlayClassName: cls,
  children,
  ...restProps
}) => (
  <Dropdown overlayClassName={classNames(styles.container, cls)} trigger={['click']} {...restProps}>
    {children}
  </Dropdown>
);

export default HeaderDropdown;
